package com.ctgu.蓝桥杯真题.B组2020第2场;

import java.io.*;
import java.util.HashMap;

/**
 * @author: Backdiy
 * @data: 2021/4/7 14:37
 * @desc:
 */
public class G单词分析 {

    public static void main(String[] args) throws IOException {
        String s = Input.nextLine();
        int max = 0;
        int [] a = new int[26];
        char c = 'z';
        for (int i = 0; i < s.length(); i++) {
            a[s.charAt(i)-'a']++;
            if(max == a[s.charAt(i)-'a']){
                c = c>s.charAt(i)?s.charAt(i):c;
            }
            if(max < a[s.charAt(i)-'a']){
                max = a[s.charAt(i)-'a'];
                c= s.charAt(i);
            }
        }
        Input.out.println(c);
        Input.out.println(max);
        Input.out.flush();
    }

    static class Input {
        static StreamTokenizer streamTokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        static PrintWriter out = new PrintWriter((new OutputStreamWriter(System.out)));
        static BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

        static int nextInt() throws IOException {
            streamTokenizer.nextToken();
            return (int) streamTokenizer.nval;
        }

        static double nextDouble() throws IOException {
            streamTokenizer.nextToken();
            return streamTokenizer.nval;
        }

        static long nextLong() throws IOException {
            streamTokenizer.nextToken();
            return (long) streamTokenizer.nval;
        }

        static String nextLine() throws IOException {
            return bufferedReader.readLine();
        }

        static char next() throws IOException {
            return (char) bufferedReader.read();
        }
    }
}
